package com.palmwindActivity.app;

import java.util.logging.Level;
import java.util.logging.Logger;



public abstract class AbstractJob implements Runnable 
{
	protected Logger logger;
	protected String tag;
	protected int id;
	protected IJobNotifier listener;
	public AbstractJob(int id, String tag, IJobNotifier listener)
	{
		this.id = id;
		this.tag = tag;
		this.listener = listener;
	}
	
	final public void run()
	{
		listener.notifyStart();
		
		executeJob();
		
		listener.notifyEnd();
	}
	abstract protected void executeJob();

	public void debug(String logMsg)
	{
		if(DemoConfig.isdebug)
		{
			if(logger == null)
			{
				logger = Logger.getLogger("JobLogger");
			}
			logger.log(Level.INFO, logMsg);
		}
	}
	
	public String getTag()
	{
		return tag;
	}
}
